/**
 *
 */
package com.example.demo.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;


@Configuration
@EnableSwagger2
public class SwaggerConfig {

    @Bean
    public Docket ecom() {
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("Ecom")
                .apiInfo(openApiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.example.demo.rest.ecom"))
                .build().apiInfo(openApiInfo());
    }

    @Bean
    public Docket account() {
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("Account")
                .apiInfo(openApiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.example.demo.rest.account"))
                .build().apiInfo(openApiInfo());

    }

    @Bean
    public Docket lenovoId() {
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("LenovoId")
                .apiInfo(openApiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.example.demo.rest.lenovoid"))
                .build().apiInfo(openApiInfo());

    }

    private ApiInfo openApiInfo() {
        return new ApiInfoBuilder().title("")
                .description("")
                .version("1.0.0")
                .contact(new Contact("", "", ""))
                .build();
    }


}
